package com.online.college.core.message.service.impl;

import com.online.college.common.page.TailPage;
import com.online.college.core.message.dao.MessageTextDao;
import com.online.college.core.message.domain.MessageText;
import com.online.college.core.message.service.IMessageTextService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class MessageTextServiceImpl implements IMessageTextService {

	@Autowired
	private MessageTextDao messageTextDao;


	@Override
	public MessageText getByMessageId(Long messageId) {
	    return messageTextDao.getByMessageId(messageId);
	}

	@Override
	public TailPage<MessageText> queryListByUserId(Long userId,TailPage<MessageText> page) {
		Integer itemsTotalCount = messageTextDao.getMessageCount(userId);
		List<MessageText> items = messageTextDao.queryListByUserId(userId,page);
		page.setItemsTotalCount(itemsTotalCount);
		page.setItems(items);
		return page;
	}

	@Override
	public void createSelectivity(MessageText entity) {
		messageTextDao.createSelectivity(entity);
	}

	@Override
	public void updateSelectivity(MessageText entity) {
		messageTextDao.updateSelectivity(entity);
	}
}

